#ifndef _CHIP_DEMO_GPIO_LED_H_
#define _CHIP_DEMO_GPIO_LED_H_


#define   GROUP(x)    (x>>16)
#define   pin(x)      (x & 0xff)


/* CCM_CCGRx register */
#define  	CCM_CCGR0 		0X20C4068
#define  	CCM_CCGR1 		0X20C406C
#define  	CCM_CCGR2 		0X20C4070
#define  	CCM_CCGR3 		0X20C4074
#define  	CCM_CCGR4 		0X20C4078
#define  	CCM_CCGR5 		0X20C407C
#define  	CCM_CCGR6 		0X20C4080

/* GPIO1模式配置地址 */
#define    	IOMUXC_GPIO1_ADDR     	(0X20E0000 + 0X5C)
/* GPIO2模式配置地址 */
#define    	IOMUXC_GPIO2_ADDR     	(0X20E0000 + 0XC4)
/* GPIO3模式配置地址 */
#define    	IOMUXC_GPIO3_ADDR     	(0X20E0000 + 0X104)
/* GPIO4模式配置地址 */
#define    	IOMUXC_GPIO4_ADDR     	(0X20E0000 + 0X178)
/* GPIO5模式配置地址 */
#define    	IOMUXC_GPIO5_ADDR     	(0X2290000 + 0X0C)

/* GPIO组 DR寄存器起始地址 */
#define  	GPIO1_DR_ADDR    0X209C000
#define  	GPIO2_DR_ADDR    0X20A0000
#define  	GPIO3_DR_ADDR    0X20A4000
#define  	GPIO4_DR_ADDR    0X20A8000
#define  	GPIO5_DR_ADDR    0X20AC000

/* 
	GPIOx结构体，
		DR寄存器（数据寄存器）
		GDIR寄存器     （方向寄存器）
		......
		......
*/
struct GPIOx{
	volatile unsigned int DR;
	volatile unsigned int GDIR;
	volatile unsigned int PSR;
	volatile unsigned int ICR1;
	volatile unsigned int ICR2;
	volatile unsigned int IMR;
	volatile unsigned int ISR;
	volatile unsigned int EDGE_SEL;
};


struct led_chip_operations {
	int (*led_init) (int which);  /* 要初始化第几个led */
	int (*led_ctl) (int which, char status); /* 控制第几个led，高低电平 */
};


#endif

